package com.ruoyi.train.service.impl;

import com.ruoyi.train.domain.JyTrainingSchool;
import com.ruoyi.train.mapper.JyTrainingSchoolMapper;
import com.ruoyi.train.service.IJyTrainingSchoolService;
import com.ruoyi.common.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 培训学校基础信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-03
 */
@Service
@RequiredArgsConstructor
public class JyTrainingSchoolServiceImpl implements IJyTrainingSchoolService {
    private final JyTrainingSchoolMapper jyTrainingSchoolMapper;

    /**
     * 查询培训学校基础信息
     *
     * @param id 培训学校基础信息主键
     * @return 培训学校基础信息
     */
    @Override
    public JyTrainingSchool selectJyTrainingSchoolById(Long id) {
        return jyTrainingSchoolMapper.selectJyTrainingSchoolById(id);
    }

    /**
     * 查询培训学校基础信息列表
     *
     * @param jyTrainingSchool 培训学校基础信息
     * @return 培训学校基础信息
     */
    @Override
    public List<JyTrainingSchool> selectJyTrainingSchoolList(JyTrainingSchool jyTrainingSchool) {
        return jyTrainingSchoolMapper.selectJyTrainingSchoolList(jyTrainingSchool);
    }

    /**
     * 审核培训学校基础信息
     *
     * @param id      编号
     * @param state   状态
     * @param remarks 备注
     * @return
     */
    @Override
    public int checkTrainingSchool(Long id, Byte state, String remarks) {
        JyTrainingSchool jyTrainingSchool = jyTrainingSchoolMapper.selectJyTrainingSchoolById(id);
        jyTrainingSchool.setState(state);
        jyTrainingSchool.setUpdateTime(DateUtils.getNowDate());
        return jyTrainingSchoolMapper.updateJyTrainingSchool(jyTrainingSchool);
    }

    @Override
    public List<JyTrainingSchool> selectJyTrainingSchoolByIds(List<Long> ids){
        return jyTrainingSchoolMapper.selectJyTrainingSchoolByIds(ids);
    }
}
